import logging
import os
import time
import allure
from app_ui.common.utils import DriverUtil
from app_ui.page.操作层 import DemoHandle


class DemoProxy:
    """业务层"""

    def __init__(self):
        self.demo_handler = DemoHandle()
        self.driver = DriverUtil.get_app_driver()

    # def user_home_page(self):
    #     allure.attach(DriverUtil.get_app_driver().get_screenshot_as_png(), "精选页截图", allure.attachment_type.PNG)
    #     self.demo_handler.click_home_page()
    #     time.sleep(2)
    #     allure.attach(DriverUtil.get_app_driver().get_screenshot_as_png(), "首页截图", allure.attachment_type.PNG)
    #
    # def user_login(self):
    #     self.demo_handler.click_login()
    #     self.demo_handler.click_mobile_login()
    #     self.demo_handler.click_other_login()
    #     time.sleep(1)
    #     os.system('adb shell input keyevent 4')
    #     logging.info("adb 命令关闭输入法软键盘")
    #     self.demo_handler.input_account("13521520865")
    #     self.demo_handler.input_user_password("woshi123456")
    #     self.demo_handler.click_user_agreement()
    #     self.demo_handler.click_confirm_login()
    #     time.sleep(6)
    #
    # def select_user(self):
    #     self.demo_handler.click_search()
    #     time.sleep(3)
    #     os.system('adb shell input keyevent 4')
    #     logging.info("adb 命令关闭输入法软键盘")
    #     self.demo_handler.input_query_input("sxlfsska")
    #     self.demo_handler.click_perform_search()
    #     time.sleep(6)
    #     self.demo_handler.click_select_user()
    #     allure.attach(DriverUtil.get_app_driver().get_screenshot_as_png(), "用户截图", allure.attachment_type.PNG)
    #     time.sleep(6)
    #     self.driver.tap([(53, 465), (209, 621)], 1000)
    #     time.sleep(5)

    def i_home(self):
        # self.demo_handler.click_i_home()
        # logging.info("查找 我")
        time.sleep(5)
        self.demo_handler.click_i_guan_zhu()
        logging.info("点击 我的 关注")
        time.sleep(5)
        # self.demo_handler.click_i_zhi_bo()
        # logging.info("进入 直播间")
        # time.sleep(10)

    # def z_dan_mu(self, send_text):
    #     self.demo_handler.click_z_srk()
    #     self.demo_handler.input_z_ssrr(send_text)
    #     self.demo_handler.click_z_fs()
    #     time.sleep(10)
